home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / slib / tk / demos / mkVScale.tcl < prev    next >
Text File  |  1994-09-20  |  1KB  |  36 lines

  1. # mkVScale w
  2. #
  3. # Create a top-level window that displays a vertical scale.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkVScale {{w .scale1}} {
  9.     catch {destroy $w}
  10.     toplevel $w
  11.     dpos $w
  12.     wm title $w "Vertical Scale Demonstration"
  13.     wm iconname $w "Scale"
  14.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
  15.         -text "A bar and a vertical scale are displayed below.  If you click or drag mouse button 1 in the scale, you can change the height of the bar.  Click the \"OK\" button when you're finished."
  16.     frame $w.frame -borderwidth 10
  17.     button $w.ok -text OK -command "destroy $w"
  18.     pack $w.msg $w.frame $w.ok
  19.  
  20.     scale $w.frame.scale -orient vertical -length 280 -from 0 -to 250 \
  21.         -command "setHeight $w.frame.right.inner" -tickinterval 50 \
  22.         -bg Bisque1
  23.     frame $w.frame.right -borderwidth 15
  24.     pack $w.frame.scale -side left -anchor ne
  25.     pack $w.frame.right -side left -anchor nw
  26.     $w.frame.scale set 20
  27.  
  28.     frame $w.frame.right.inner -geometry 40x20 -relief raised \
  29.         -borderwidth 2 -bg SteelBlue1
  30.     pack $w.frame.right.inner -expand yes -anchor nw
  31. }
  32.  
  33. proc setHeight {w height} {
  34.     $w config -geometry 40x${height}
  35. }
  36.